/*
 * XML Type:  InterfaceModel
 * Namespace: http:///org/isistan/flabot/coremodel.ecore
 * Java type: org.isistan.flabot.coremodelEcore.InterfaceModel
 *
 * Automatically generated - do not modify.
 */
package org.isistan.flabot.coremodelEcore.impl;
/**
 * An XML InterfaceModel(@http:///org/isistan/flabot/coremodel.ecore).
 *
 * This is a complex type.
 */
public class InterfaceModelImpl extends org.isistan.flabot.coremodelEcore.impl.NamedElementModelImpl implements org.isistan.flabot.coremodelEcore.InterfaceModel
{
    private static final long serialVersionUID = 1L;
    
    public InterfaceModelImpl(org.apache.xmlbeans.SchemaType sType)
    {
        super(sType);
    }
    
    private static final javax.xml.namespace.QName PORT$0 = 
        new javax.xml.namespace.QName("", "port");
    private static final javax.xml.namespace.QName PORT2$2 = 
        new javax.xml.namespace.QName("", "port");
    
    
    /**
     * Gets array of all "port" elements
     */
    public org.isistan.flabot.coremodelEcore.PortModel[] getPortArray()
    {
        synchronized (monitor())
        {
            check_orphaned();
            java.util.List targetList = new java.util.ArrayList();
            get_store().find_all_element_users(PORT2$2, targetList);
            org.isistan.flabot.coremodelEcore.PortModel[] result = new org.isistan.flabot.coremodelEcore.PortModel[targetList.size()];
            targetList.toArray(result);
            return result;
        }
    }
    
    /**
     * Gets ith "port" element
     */
    public org.isistan.flabot.coremodelEcore.PortModel getPortArray(int i)
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.isistan.flabot.coremodelEcore.PortModel target = null;
            target = (org.isistan.flabot.coremodelEcore.PortModel)get_store().find_element_user(PORT2$2, i);
            if (target == null)
            {
                throw new IndexOutOfBoundsException();
            }
            return target;
        }
    }
    
    /**
     * Returns number of "port" element
     */
    public int sizeOfPortArray()
    {
        synchronized (monitor())
        {
            check_orphaned();
            return get_store().count_elements(PORT2$2);
        }
    }
    
    /**
     * Sets array of all "port" element  WARNING: This method is not atomicaly synchronized.
     */
    public void setPortArray(org.isistan.flabot.coremodelEcore.PortModel[] portArray)
    {
        check_orphaned();
        arraySetterHelper(portArray, PORT2$2);
    }
    
    /**
     * Sets ith "port" element
     */
    public void setPortArray(int i, org.isistan.flabot.coremodelEcore.PortModel port)
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.isistan.flabot.coremodelEcore.PortModel target = null;
            target = (org.isistan.flabot.coremodelEcore.PortModel)get_store().find_element_user(PORT2$2, i);
            if (target == null)
            {
                throw new IndexOutOfBoundsException();
            }
            target.set(port);
        }
    }
    
    /**
     * Inserts and returns a new empty value (as xml) as the ith "port" element
     */
    public org.isistan.flabot.coremodelEcore.PortModel insertNewPort(int i)
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.isistan.flabot.coremodelEcore.PortModel target = null;
            target = (org.isistan.flabot.coremodelEcore.PortModel)get_store().insert_element_user(PORT2$2, i);
            return target;
        }
    }
    
    /**
     * Appends and returns a new empty value (as xml) as the last "port" element
     */
    public org.isistan.flabot.coremodelEcore.PortModel addNewPort()
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.isistan.flabot.coremodelEcore.PortModel target = null;
            target = (org.isistan.flabot.coremodelEcore.PortModel)get_store().add_element_user(PORT2$2);
            return target;
        }
    }
    
    /**
     * Removes the ith "port" element
     */
    public void removePort(int i)
    {
        synchronized (monitor())
        {
            check_orphaned();
            get_store().remove_element(PORT2$2, i);
        }
    }
    
    /**
     * Gets the "port" attribute
     */
    public java.lang.String getPort2()
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.apache.xmlbeans.SimpleValue target = null;
            target = (org.apache.xmlbeans.SimpleValue)get_store().find_attribute_user(PORT2$2);
            if (target == null)
            {
                return null;
            }
            return target.getStringValue();
        }
    }
    
    /**
     * Gets (as xml) the "port" attribute
     */
    public org.apache.xmlbeans.XmlString xgetPort2()
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.apache.xmlbeans.XmlString target = null;
            target = (org.apache.xmlbeans.XmlString)get_store().find_attribute_user(PORT2$2);
            return target;
        }
    }
    
    /**
     * True if has "port" attribute
     */
    public boolean isSetPort2()
    {
        synchronized (monitor())
        {
            check_orphaned();
            return get_store().find_attribute_user(PORT2$2) != null;
        }
    }
    
    /**
     * Sets the "port" attribute
     */
    public void setPort2(java.lang.String port2)
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.apache.xmlbeans.SimpleValue target = null;
            target = (org.apache.xmlbeans.SimpleValue)get_store().find_attribute_user(PORT2$2);
            if (target == null)
            {
                target = (org.apache.xmlbeans.SimpleValue)get_store().add_attribute_user(PORT2$2);
            }
            target.setStringValue(port2);
        }
    }
    
    /**
     * Sets (as xml) the "port" attribute
     */
    public void xsetPort2(org.apache.xmlbeans.XmlString port2)
    {
        synchronized (monitor())
        {
            check_orphaned();
            org.apache.xmlbeans.XmlString target = null;
            target = (org.apache.xmlbeans.XmlString)get_store().find_attribute_user(PORT2$2);
            if (target == null)
            {
                target = (org.apache.xmlbeans.XmlString)get_store().add_attribute_user(PORT2$2);
            }
            target.set(port2);
        }
    }
    
    /**
     * Unsets the "port" attribute
     */
    public void unsetPort2()
    {
        synchronized (monitor())
        {
            check_orphaned();
            get_store().remove_attribute(PORT2$2);
        }
    }
}
